#include "SMPPCancelSM.hpp"

using namespace smpp::pdu;

CancelSM::CancelSM(const Header &nHeader,
const CoctetString &nServiceType,
const CoctetString &nMessageId,
const quint8 nSourceAddrTON,
const quint8 nSourceAddrNPI,
const CoctetString &nSourceAddr,
const quint8 nDestAddrTON,
const quint8 nDestAddrNPI,
const CoctetString &nDestAddr):
Header(nHeader),
_ServiceType(nServiceType),
_MessageId(nMessageId),
_SourceAddrTON(nSourceAddrTON),
_SourceAddrNPI(nSourceAddrNPI),
_SourceAddr(nSourceAddr),
_DestAddrTON(nDestAddrTON),
_DestAddrNPI(nDestAddrNPI),
_DestAddr(nDestAddr){}

CancelSM::CancelSM(const CancelSM &nCancelSM):
Header(nCancelSM),
_ServiceType(nCancelSM.getServiceType()),
_MessageId(nCancelSM.getMessageId()),
_SourceAddrTON(nCancelSM.getSourceAddrTON()),
_SourceAddrNPI(nCancelSM.getSourceAddrNPI()),
_SourceAddr(nCancelSM.getSourceAddr()),
_DestAddrTON(nCancelSM.getDestAddrTON()),
_DestAddrNPI(nCancelSM.getDestAddrNPI()),
_DestAddr(nCancelSM.getDestAddr()){}

void CancelSM::setServiceType(const CoctetString &nServiceType){
	_ServiceType = nServiceType;
}

const CoctetString &CancelSM::getServiceType() const{
	return _ServiceType;
}

void CancelSM::setMessageId(const CoctetString &nMessageId){
	_MessageId = nMessageId;
}

const CoctetString &CancelSM::getMessageId() const{
	return _MessageId;
}

void CancelSM::setSourceAddrTON(const quint8 nSourceAddrTON){
	_SourceAddrTON = nSourceAddrTON;
}

const quint8 CancelSM::getSourceAddrTON() const{
	return _SourceAddrTON;
}

void CancelSM::setSourceAddrNPI(const quint8 nSourceAddrNPI){
	_SourceAddrNPI = nSourceAddrNPI;
}

const quint8 CancelSM::getSourceAddrNPI() const{
	return _SourceAddrNPI;
}

void CancelSM::setSourceAddr(const CoctetString &sSourceAddr){
	_SourceAddr = sSourceAddr;
}

const CoctetString &CancelSM::getSourceAddr() const{
	return _SourceAddr;
}

void CancelSM::setDestAddrTON(const quint8 nDestAddrTON){
	_DestAddrTON = nDestAddrTON;
}

const quint8 CancelSM::getDestAddrTON() const{
	return _DestAddrTON;
}

void CancelSM::setDestAddrNPI(const quint8 nDestAddrNPI){
	_DestAddrNPI = nDestAddrNPI;
}

const quint8 CancelSM::getDestAddrNPI() const{
	return _DestAddrNPI;
}

void CancelSM::setDestAddr(const CoctetString &sDestAddr){
	_DestAddr = sDestAddr;
}
const CoctetString &CancelSM::getDestAddr() const{
	return _DestAddr;
}

void CancelSM::calcCommandLength(){
	_CommandLength = 20 + _ServiceType.size() + _MessageId.size() + _SourceAddr.size() +
		_DestAddr.size();
}
